//
//  PayArrayModel.swift
//  Pods
//
//  Created by eme on 2017/3/28.
//
//

import Foundation
import SwiftyJSON
import ModelProtocol

class PayArrayModel: ModelProtocol {
    
    // MARK: Declaration for string constants to be used to decode and also serialize.
    internal let PayArrayOrderamountKey: String = "orderamount"
    internal let PayArrayTotalnumberKey: String = "totalnumber"
    internal let PayArrayBdnameKey: String = "bdname"
    internal let PayArrayTotalorderamountKey:String = "totalorderamount"
    
    
    // MARK: 属性
    var orderamount: Double
    var totalnumber: String
    var bdname: String
    var totalorderamount:Double
    
    
    
    // MARK: 实现MikerSwiftJSONAble 协议， 解析json数据
    required  init?(json: JSON) {
        orderamount = json[PayArrayOrderamountKey].doubleValue
        totalnumber = json[PayArrayTotalnumberKey].stringValue
        bdname = json[PayArrayBdnameKey].stringValue
        totalorderamount = json[PayArrayTotalorderamountKey].doubleValue
    }
    
    
    /**
     Generates description of the object in the form of a NSDictionary.
     - returns: A Key value pair containing all valid values in the object.
     */
    internal func dictionaryRepresentation() -> [String : AnyObject ] {
        
        var dictionary: [String : AnyObject ] = [ : ]
        
        dictionary.updateValue(orderamount as AnyObject, forKey: PayArrayOrderamountKey)
    
        dictionary.updateValue(totalnumber as AnyObject, forKey: PayArrayTotalnumberKey)
    
        dictionary.updateValue(bdname as AnyObject, forKey: PayArrayBdnameKey)
    
        dictionary.updateValue(totalorderamount as AnyObject, forKey: PayArrayTotalorderamountKey)
        
        
        return dictionary
    }
    
    
}

